"""
Django 的 ll_project 项目的设置。

通过 'django-admin startproject' 使用 Django 4.1.13 生成。

有关此文件的更多信息，请参阅
https://docs.djangoproject.com/en/4.1/topics/settings/

有关设置及其值的完整列表，请参阅
https://docs.djangoproject.com/en/4.1/ref/settings/
"""

from pathlib import Path

# 在项目中构建路径，例如：BASE_DIR / '子目录'。
BASE_DIR = Path(__file__).resolve().parent.parent


# 快速启动开发设置 - 不适合生产环境
# 请参阅 https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# 安全警告：请将生产环境中使用的密钥保密！
SECRET_KEY = "django-insecure-&$(gs_)^lz==^j1bu_64+&-w7f!^!8xye$(h^@u6v6cq6f^#mp"

# 安全警告：不要在生产环境中启用调试模式！
DEBUG = True

ALLOWED_HOSTS = []


# 应用程序定义

INSTALLED_APPS = [
    # 我的应用程序
    "learning_logs",
    # Django 默认添加的应用程序
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
]

MIDDLEWARE = [
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "ll_project.urls"

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.template.context_processors.debug",
                "django.template.context_processors.request",
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
            ],
        },
    },
]

WSGI_APPLICATION = "ll_project.wsgi.application"


# 数据库
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": BASE_DIR / "db.sqlite3",
    }
}


# 密码验证
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
    },
    {
        "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
    },
]


# 国际化
# https://docs.djangoproject.com/en/4.1/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_TZ = True


# 静态文件（CSS、JavaScript、图片）
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = "static/"

# 默认主键字段类型
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
